<table class="table table-striped" id="transactions_table">
    <thead>
        <tr>
            <th colspan="2">Date</th>
            <th>Time</th>
            <th>Payment</th>
            <th style="">Amt.(GHS)</th>
            <th style="text-align: center;">Teller</th>
            <th style="text-align: center;">Options</th>
        </tr>
    </thead>
    <tbody>
        <?php
        $count = 1;
        foreach ($student['Transaction'] as $transaction) {
            $label = "";
            if($transaction['authorize'] == 'Pending'){
                $label = "<span id='account_balance' class='label label-important' style='padding: 1px 5px; font-weight: bold;'>Pending (Auth.)</span>";
            }

            if (!isset($transaction['TransactionBankDetail'][0])) {
                continue;
            }
            ?>
            <tr data-transaction-id="<?php echo $transaction['id']; ?>">
                <td style="text-align: right;"><?php echo $count++; ?>.</td>
                <td class="date"><?php echo date('d-M-Y', strtotime($transaction['created'])); ?></td>
                <td class="time"><?php echo date('H:i', strtotime($transaction['created'])); ?></td>
                <td class="pay_method"><?php echo $transaction['TransactionBankDetail'][0]['payment_method']; ?></td>
                <td class="amount" style=""><?php echo number_format($transaction['TransactionBankDetail'][0]['credit_amt'], 2, '.', ',')." $label"; ?></td>
                <td style="text-align: center;">
                    <?php echo $transaction['BankUser']['fname'].' '.$transaction['BankUser']['lname']; ?>
                </td>
                <td style="text-align: center;">
                    <?php
                    $limit = new DateTime(date('Y-m-d 21:00'));
                    $transDate = new DateTime($transaction['created']);
                    $now = new DateTime();

                    // if current time is less than reversal limit and transaction was done today
                    if ($now < $limit && $transDate->format('Y-m-d') == date('Y-m-d') && $transaction['reverted'] == '0') {
                        ?>
                        <a href="javascript:void(0);" class="btn btn-mini btn-danger revert_btn"><i class="icon icon-undo"></i> Revert</a>
                        <!--<a href="javascript:void(0);" class="btn btn-mini btn-info"><i class="icon icon-info-sign"></i> Request Reversal</a>-->
                    <?php
                    }
                    ?>
                </td>
            </tr>
        <?php } ?>
    </tbody>
</table>